<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
    <style>
        .mint-msgbox-message {
            color: black !important;
            margin: 0;
            text-align: center;
            line-height: normal !important;
        }
    </style>
    <script>
        document.getElementsByTagName('html')[0].style.fontSize = '15px'
    </script>
    <!-- 引入样式 -->
    <link rel="stylesheet" href="./css/common.css">
    <link rel="stylesheet" href="./css/icon.css">
    <link rel="stylesheet" href="./css/mint.min.css">
    <!-- 先引入 Vue -->
    <script src="js/vue.min.js"></script>
    <!-- 引入组件库 -->
    <script src="js/mint.min.js"></script>
    <!--web请求-->
    <script src="js/webservice.js"></script>
    <title> </title>
</head>
<body>
<div class="bgcolor" id="app">
    <div v-for="(itm,idx) in risOrdList" :key="itm.oeordId" :key="itm"
         @click="onItemClick(itm.reportNote)"
         class="bgwhite padding8 margin5 radius5">
        <div class="flexHL">
            <div class="font12 width40 marginT5 radius20 center" :style="getStaColor(itm.reportStat)">
                {{itm.reportStat == "Y" ? "已出" : "未出"}}
            </div>
        </div>
        <div class="flexVL marginT5">
            <div class="font17 fontBold marginT5">{{itm.orderName}}</div>
            <div class="font14 gray marginT5">{{itm.reportDateTime+"&nbsp;&nbsp;&nbsp;&nbsp; "+itm.reportDoc}}</div>
            <div class="line marginTB5"></div>
            <div :class="getStaClass(itm.reportStat)">查看文字报告</div>
        </div>
    </div>
    <div v-if="emptyFlag" class="marginT50 flexHC">暂无检查项目</div>
</div>
</body>
<script>
    new Vue({
        el: '#app',
        data: {
            episodeId: "",
            startDate: "",
            endDate: "",
            patmsg: "",
            risOrdList: [],
            emptyFlag: false,
        },
        mounted() {
            //将要给原生调用的方法挂载到 window 上面
            window.Config = this.Config
            window.getScanMsg = this.getScanMsg
            window.GetRisOrderList = this.GetRisOrderList
            this.episodeId = this.GetQueryString('episodeId');
            this.patmsg = this.GetQueryString('patmsg');
            console.log(this.episodeId, this.patmsg);
            document.title = this.episodeId + '  ' + this.patmsg; //网页改变title
            this.Config()
            this.initData()
        },
        methods: {
            //获取配置
            Config() {
                var content = JSON.stringify({
                    title: this.patmsg,
                    hideToolBar: "",
                    toolBar: {
                        show: "1",
                        type: "text",
                        text: "确定",
                        image: "",
                        method: "save"
                    }
                })
                if (window.android) {
                    window.android.callAndroid(content, "config");
                }
            },
            //获取扫码
            getScanMsg(scanInfo) {
                this.$toast(scanInfo)
            },
            GetRisOrderList(data) {
                Http.hideLoading(this)
                this.risOrdList = data.risOrdList
                this.emptyFlag = this.risOrdList.length === 0
            },
            initData() {
                var params = {
                    episodeId: this.episodeId,
                    startDate: this.startDate,
                    endDate: this.endDate,
                }
                Http.showLoading(this)
                Http.postPlus("GetRisOrderList", params, (data) => {
                    console.log(data)
                    this.GetRisOrderList(data);
                })
            },
            GetQueryString(name) {
                console.log(name);
                var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
                var r = window.location.search.substr(1).match(reg);
                if (r != null) {
                    if(r[2].indexOf('%') > -1) {
                        var rStr= r[2].replace(/%/g,'%25')
                        return decodeURI(rStr);
                    }
                    return decodeURI(r[2]);
                }
                return null;
            },
            getStaColor(sta) {
                if (sta === "Y") {
                    return 'background: #B8DA64; color:white'
                }
                return 'background: #FFC33C; color:white'
            },
            getStaClass(sta) {
                if (sta === "Y") {
                    return "matchW center font13 colorblue"
                }
                return "matchW center font13 gray"
            },
            onItemClick(reportNote) {
                this.$messagebox({
                    title: '报告结果',
                    message: reportNote,
                    confirmButtonText:"确定",
                    showCancelButton: false,
                    confirmButtonHighlight:true
                });
            }
        }
    })

</script>

</html>